package com.kayang.feishu.service;


import com.kayang.common.HttpResilience4jCommand;
import com.kayang.common.aop.IService;
import com.kayang.common.aop.SPEnable;
import com.kayang.feishu.pojo.FeiShuContext;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class DeptService implements IService {
    public String getBeforeSp() {
        // 参数{String json}  json请求信息，请求后包含响应。
        return "WSP_FeiShuDeptEdit";
    }

    @Override
    public String getAfterSp() {
        // 参数{String json}  json请求信息，请求后包含响应。
        return "WSP_FeiShuDeptEdit";
    }


    @SPEnable
    public Map creatDept(Map param,  FeiShuContext context, Map header){
        HttpResilience4jCommand httpResilience4jCommand = new HttpResilience4jCommand(context.getUrl(), context.getMethod(), param, header);
        Map ret = httpResilience4jCommand.execute();
        context.setRespbody(ret);
        return ret;
    }

    @SPEnable
    public Map updateDept(Map param, FeiShuContext context, Map header){
        HttpResilience4jCommand httpResilience4jCommand = new HttpResilience4jCommand(context.getUrl(), context.getMethod(), param, header);
        Map ret = httpResilience4jCommand.execute();
        context.setRespbody(ret);
        return ret;
    }

    @SPEnable
    public Map deleteDept( Map param, FeiShuContext context, Map header){
        HttpResilience4jCommand httpResilience4jCommand = new HttpResilience4jCommand(context.getUrl(), context.getMethod(), param, header);
        Map ret = httpResilience4jCommand.execute();
        context.setRespbody(ret);
        return ret;
    }



    @SPEnable
    //获取单个部门详情
    public Map getDept(FeiShuContext context, Map header){
        HttpResilience4jCommand httpResilience4jCommand = new HttpResilience4jCommand(context.getUrl(), context.getMethod(), new HashMap<>(), header);
        Map ret = httpResilience4jCommand.execute();
        context.setRespbody(ret);
        return ret;
    }






}
